#include "pch.h"
#include "FButton.h"
extern void DebugPrintf(const char* strOutputString, ...);

FButton::FButton(FasControll* parent,CONST WCHAR * title):FasControll(parent)
{
    this->mTitle = title;
}

LRESULT FButton::Dispatch(UINT message, WPARAM wParam, LPARAM lParam)
{
    DebugPrintf("%x\n",message);
    if (message == WM_LBUTTONDOWN)
    {
        return 0;
    }
    return CallWindowProc(this->oldProc, this->mWnd, message, wParam, lParam);
}



void FButton::Create()
{
    mWnd = CreateWindowEx(0,
        _T("FBUTTON"),
        this->mTitle,
        WS_CHILD | WS_VISIBLE, // | WS_DISABLED
        this->mPosX, // xpos
        this->mPosY, // ypos
        this->mWidth, //width
        this->mHeight, //height
        this->mParent->mWnd,
        (HMENU)0,
        this->mParent->mInstance,
        this);
    ::SetWindowLongPtr(mWnd, GWLP_USERDATA, reinterpret_cast<LPARAM>(this));
    oldProc = (WNDPROC)::SetWindowLong(mWnd, GWL_WNDPROC, (LONG)FasControll::StaticWndProc);
}
